//
//  ShapeCollection1.swift
//  ArchitectGenerics
//
//  Created by 姚胜龙 on 2017/6/27.
//  Copyright © 2017年 姚胜龙. All rights reserved.
//

import UIKit

//图形集合
class ShapeCollection1 {

    private var  shapeArray:Array<ShapeProtocol>
    init() {
        self.shapeArray = Array<ShapeProtocol>()
        self.shapeArray.append(SquareShape1(length: 10))
        self.shapeArray.append(RectangleShape1(width: 20, height: 40))
        self.shapeArray.append(CircleShape1(redius: 30))
    }

    //接受者
    func accept(visitor:ShapeVisitorProtocol) {
        for shape in self.shapeArray {
            shape.accept(visitor: visitor)
        }
    }

}
